package cn.ruihusoft.ql.client;

import cn.ruihusoft.ql.pojo.ListResponse;
import cn.ruihusoft.ql.pojo.Response;
import cn.ruihusoft.ql.pojo.cron.AddCronLabelRequest;
import cn.ruihusoft.ql.pojo.cron.AddCronRequest;
import cn.ruihusoft.ql.pojo.cron.CronDetailResponse;
import cn.ruihusoft.ql.pojo.cron.CronStatusResponse;
import cn.ruihusoft.ql.pojo.cron.UpdateCronRequest;
import com.dtflys.forest.annotation.Delete;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.Post;
import com.dtflys.forest.annotation.Put;
import com.dtflys.forest.annotation.Var;

import java.util.List;

public interface CronClient extends BaseAuthClient {

    @Get("/crons")
    ListResponse<CronDetailResponse> allCron();

    @Post("/crons")
    Response<String> addCron(@JSONBody AddCronRequest request);

    @Put("/crons")
    Response<String> updateCron(@JSONBody UpdateCronRequest request);

    @Delete("/crons")
    Response<String> deleteCron(@JSONBody List<Integer> ids);

    @Get("/crons/{id}")
    Response<CronDetailResponse> cronDetail(@Var("id") Integer id);

    @Put("/crons/run")
    Response<String> runCrons(@JSONBody List<Integer> ids);

    @Put("/crons/stop")
    Response<String> stopCrons(@JSONBody List<Integer> ids);

    @Post("/crons/labels")
    Response<String> addLabels(@JSONBody AddCronLabelRequest request);

    @Delete("/crons/labels")
    Response<String> deleteLabels(@JSONBody AddCronLabelRequest request);

    @Put("/crons/disable")
    Response<String> disableCron(@JSONBody List<Integer> ids);

    @Put("/crons/enable")
    Response<String> enableCron(@JSONBody List<Integer> ids);

    @Get("/crons/{id}/log")
    Response<String> getCronLog(@Var("id") Integer id);

    @Put("/crons/pin")
    Response<String> pinCron(@JSONBody List<Integer> ids);

    @Put("/crons/unpin")
    Response<String> unpinCron(@JSONBody List<Integer> ids);

    @Post("/crons/import")
    Response<String> importCron();

    @Put("/crons/status")
    CronStatusResponse status();
}
